package entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Rsp {



    private int code;

    private String msg;

    private Object content;


    public static Rsp success(Object object){
        Rsp rsp = new Rsp();

        rsp.setCode(20000);
        rsp.setMsg("请求成功");
        rsp.setContent(object);

        return rsp;
    }


    public static Rsp fail(){
        Rsp rsp = new Rsp();

        rsp.setCode(50000);
        rsp.setMsg("请求失败");
        rsp.setContent(null);

        return rsp;
    }

    public Rsp code(int code){

        this.setCode(code);

        return this;
    }

    public Rsp msg(String msg){

        this.setMsg(msg);

        return this;
    }



}
